<template>
	<view>
		<view class="h_10"></view>
		<view class="list" v-if="list.length > 0"  v-for="(item,index) in list" :key="index">
			<view class="listItem">
				<view class="itemRight">
					<view class="itemRightTitle">姓名：{{item.name}}</view>
					<view class="itemRightText1">手机号码：{{item.mobile}}</view>
					<view class="itemRightText">咨询时间：{{item.createtime_text}}</view>
					<view class="itemRightText">性别：{{item.sex_text}}</view>
					<view class="itemRightTitleFlex">
						<view class="stateText2" v-if="item.status == 1">已处理</view>
						<view class="stateText1" v-if="item.status == 2">待处理</view>
					</view>
					<view class="listFlex" v-if="item.content">
						<view class="listFlexItem">描述：{{item.content}}</view>
					</view>
					<view class="listFlex" v-if="item.status == 1">
						<view class="listFlexItem">处理结果：{{item.result}}</view>
					</view>
				</view>
			</view>
		</view>
		<block v-if="list.length === 0 && status !== 'loading'">
			<wanl-empty :text="empty" />
		</block>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				list: [],
				params: {
					keyword: '',
					page: 1
				},
				empty: '没有找到咨询列表',
				reload: true, //判断是否上拉
				last_page: 0,
				status: 'loading',
				contentText: {
					contentdown: '',
					contentrefresh: '正在加载..',
					contentnomore: '没有更多数据了'
				},
				city:''
				
			}
		},
		onLoad() {
			
		},
		onShow() {
			this.loadData()
		},
		// 下拉刷新
		onReachBottom() {
			if (this.params.page >= this.last_page) {
				this.status = 'noMore';
			} else {
				this.reload = false;
				this.contentText.contentdown = '上拉显示更多';
				this.params.page = this.params.page + 1; //页码+1
				this.status = 'loading';
				this.loadData();
			}
		},
		methods: {
			jump(url) {
				this.$wanlshop.auth(url)
				// uni.navigateTo({
				// 	url: url
				// })
			},
			//异步加载商品列表
			async loadData() {
				await uni.request({
					url: '/addons/nursing/api.consult/lists',
					data: this.params,
					method: 'POST',
					success: res => {
						this.status = 'more';
						console.log("res",res)
						this.list = this.reload ? res.data.data : this.list.concat(res.data.data
							); //数据 追加
						if (res.data.length == 0) {
							this.empty = `没有找到咨询列表`;
						}
						this.params.page = res.data.current_page; //当前页码
						this.last_page = res.data.last_page; //总页码
					}
				});
			},
		}
	}
</script>

<style lang="scss">
	.top {
		width: 100%;
		height: 94rpx;
		background: #fff;

		.topFlex {
			display: flex;
			align-items: center;
			width: 690rpx;
			height: 100%;
			margin: 0 auto;

			.topFlexLeft {
				display: flex;
				align-items: center;
				color: #4CBD66;
				width: 128rpx;

				.topFlexLeftText {
					margin-right: 10rpx;
				}

				.iconfont {
					font-size: 14rpx;
				}
			}

			.topFlexInt {
				width: 500rpx;
				height: 60rpx;
				border-radius: 30rpx;
				border: 2rpx solid #4CBD66;
				margin-left: 10rpx;
				display: flex;
				align-items: center;
				color: #4CBD66;

				.iconfont {
					margin-left: 22rpx;
				}

				.int {
					width: 400rpx;
					font-size: 26rpx;
					font-family: PingFang SC-Medium, PingFang SC;
					font-weight: 500;
					color: #4CBD66;
					margin-left: 20rpx;
				}

				.intm {
					font-size: 26rpx;
					font-family: PingFang SC-Medium, PingFang SC;
					font-weight: 500;
					color: #4CBD66;
				}
			}

			.topFlexRight {
				margin-left: auto;
				text-align: center;
				color: #4CBD66;
				font-size: 20rpx;
				font-family: PingFang SC-Medium, PingFang SC;
				font-weight: 500;

				.topFlexRightText {
					margin-top: 10rpx;
				}
			}
		}
	}
.h_10{
		width: 100%;
		height: 20rpx;
	}
	.list {
		width: 92%;
		height: auto;
		margin:0 auto 20rpx auto;
		background: #fff;
		border-radius: 10rpx;
		position: relative;

		.listItem {
			padding: 18rpx;
			display: flex;

			.itemImg {
				width: 232rpx;
				height: 154rpx;
				border-radius: 10rpx;
			}

			.itemRight {
				// width: 390rpx;
				height: auto;
				// margin-left: auto;

				.itemRightTitle {
					font-size: 32rpx;
					font-family: PingFang SC-Bold, PingFang SC;
					font-weight: bold;
					color: #333333;
					overflow: hidden;
					text-overflow: ellipsis;
					white-space: nowrap;
					margin-bottom: 12rpx;
				}
				.itemRightText {
					overflow: hidden;
					text-overflow: ellipsis;
					white-space: nowrap;
					font-size: 26rpx;
					color: #999;
					margin-bottom: 10rpx;
				}
				.itemRightText1 {
					overflow: hidden;
					text-overflow: ellipsis;
					white-space: nowrap;
					font-size: 26rpx;
					color: #333;
					margin-bottom: 10rpx;
				}
				.itemRightTitleFlex {
					display: flex;
					align-items: center;
					font-size: 26rpx;
					font-family: PingFang SC-Medium, PingFang SC;
					font-weight: 500;
					color: #555555;
					margin-top: 6rpx;
					position: absolute;
					top: 18rpx;
					right: 18rpx;
					.stateText1{
						color: #E31F1F;
						padding: 5rpx 10rpx;
						border: 1rpx solid #E31F1F;
						border-radius: 10rpx;
					}
					.stateText2{
						padding: 5rpx 10rpx;
						border: 1rpx solid #4CBD66;
						border-radius: 10rpx;
						color: #4CBD66;
					}
					.stateText3{
						padding: 5rpx 10rpx;
						border: 1rpx solid #4383ff;
						border-radius: 10rpx;
						color: #4383ff;
					}
					.iconfont {
						font-size: 20rpx;
						color: #4CBD66;
						margin-right: 10rpx;
					}

					.itemRightText {
						overflow: hidden;
						text-overflow: ellipsis;
						white-space: nowrap;
					}
				}


				.listFlex {
					display: flex;
					width: 100%;
					flex-wrap: wrap;

					.listFlexItem {
						padding: 2rpx 0;
						border-radius: 6rpx;
						margin-right: 10rpx;
						font-size: 26rpx;
						font-family: PingFang SC-Medium, PingFang SC;
						font-weight: 500;
						color: #888888;
					}
				}

				.itemRightMoney {
					font-size: 38rpx;
					font-family: DIN-Bold, DIN;
					font-weight: bold;
					color: #E31F1F;
					margin-top: 10rpx;
				}

			}
		}
	}
</style>
